package org.qiancizhan.UI;


import org.qiancizhan.Model.POJO.UserPOJO;
import org.qiancizhan.Utils.ThreadLocalUtil;
import org.qiancizhan.Utils.UIFormatUtli;

import java.util.Scanner;

public class IndexUI {
    private static final Scanner sc = new Scanner(System.in);

    public static void showIndexMenu() {
        UserPOJO user = ThreadLocalUtil.get();
        while (true) {
            UIFormatUtli.log("欢迎" + user.getUsername() + "!");
            UIFormatUtli.log("1.我的词书\t2.我的收藏单词\t3.单词训练");
            UIFormatUtli.log("4.离线查询单词\t5.在线查询|翻译\t6.AI英语助手");
            UIFormatUtli.log("7.切换账号\t0.退出程序");
            int choice = sc.nextInt();
            switch (choice) {
                case 1 -> VocabularyUI.showIndexMenu();
                case 2 -> CollectionUI.showIndexMenu();
                case 3 -> TrainUI.showIndexMenu();
                case 4 -> SearchUI.disConnectionMenu();
                case 5 -> TranslateUI.showTranslateMenu();
                case 6 -> AssistantUI.showAssistantMenu();
                case 7 -> {
                    ThreadLocalUtil.remove();
                    System.out.println("请重新登录");
                    UserUI.showLoginMenu();
                }
                case 0 -> {
                    System.out.println("程序退出");
                    System.exit(0);
                }
                default -> System.out.println(("请选择正确的选项"));
            }
        }
    }
}
